<?php
require "../factory/lib/shape.php";

abstract class ShapeDecorator implements Shape
{
    /** @var Shape $shape */
    protected $shape=null;
    public function __construct($shape)
    {
        $this->shape=$shape;
    }
    public function draw()
    {
        $this->shape->draw();
    }
}

class RedShapeDecorator extends ShapeDecorator
{
    public function draw()
    {
        echo "Red";
        $this->shape->draw();
    }
}

$rsd=new RedShapeDecorator(new Rectangle);
$rsd->draw();
